<?php
session_start();
/**
 * 登录验证
 */
require "../util/DBUtil.php";
$user = $_POST[account];
$paw = $_POST[password];
$sql = "select * from tb_user where userName=? and password=?";
$pram = array($user, $paw);
$check_user = new DBUtil();
$login_user = $check_user->query($sql, $pram)[0];
//print_r($login_user);
if (count($login_user) != 0) {
    $_SESSION['login_user'] = serialize($login_user);   //序列化并存到session中
//    echo $_SESSION['login_user']."----";
//    print_r(unserialize($_SESSION['login_user']));
echo "<script>history.back();</script>";
} else {
    echo "<script>alert('账号或密码错误');history.back();</script>";
}
$check_user->close();
